#ifndef __local_resource_h__
#define __local_resource_h__

#include "windefine.h"
#include <stdio.h>

#include "../base/file_helper.h"
#include "../base/image_helper.h"
#include "winimage.h"
#include "winresource.h"

#include <map>
#include <gdiplus.h>
#pragma comment(lib, "gdiplus.lib")

class WinLocalResourceImpl : public WinResourceImpl
{
public:
    WinLocalResourceImpl();
    ~WinLocalResourceImpl();

public:
    BOOL    GetBinaryResource( LPCTSTR lpszFile, BYTE ** pBuffer, DWORD *dwSize, BOOL bCache );
    BOOL    GetImage( LPCTSTR lpszFile, WinImage & winImage, BOOL bCache );

public:
    CString GetWorkspace()                              { return m_strWorkspace; }

private:
    void Initialize();

private:
    Gdiplus::GdiplusStartupInput m_gdiplusStartupInput;
    ULONG_PTR m_pGdiToken;

    CString m_strWorkspace;

    typedef std::map<CString, WinImage *> _imgcache;
    _imgcache m_mapCache;
};

#endif